import 'package:flutter/material.dart';
import 'package:flutter_demo/chapter10-CustomWidget/done-widget/RenderDoneObject.dart';

class DoneRender extends LeafRenderObjectWidget {

  // 线条宽度
  final double? strokeWidth;
  // 轮廓颜色或填充色
  final Color? color;
  // 如果为true则没有填充色，color嗲表轮廓的颜色;如果为false，则color为填充色
  final bool? outline;

  const DoneRender ({
    Key? key,
    this.strokeWidth = 2.0,
    this.color = Colors.green,
    this.outline = false,
}) : super(key:key);

  @override
  RenderObject createRenderObject(BuildContext context) {
    return RenderDoneObject(
      strokeWidth!,
      color!,
      outline!,
    )..animationStatus = AnimationStatus.forward; // 创建时执行正向动画
  }

  @override
  void updateRenderObject(context, RenderDoneObject renderObject) {
    renderObject
      ..strokeWidth = strokeWidth!
      ..outline = outline!
      ..color = color!;
  }
}